#ifndef ABSUI_UI_CONFIGURATION_CENTER_HPP
#define ABSUI_UI_CONFIGURATION_CENTER_HPP

#include "AbsUI/AbsUIConfig.hpp"
#include "Storage/ConfigurationCenter.hpp"

namespace AbsUI
{

class ConfCfgWidgetFactory;
class UIFactory;

/// @ingroup AbsUI
/// @brief It extends the configuration center from the model layer with new features, like user interface factory and 
///		user interface specific configurations.
///
/// It provides new factories that should be used for creating UI elements. Since this layer is abstract, it assumes 
///	that the factory is created by the main application (at that point there is clear what UI framework is used) and 
///	passed by reference to an instance of this class for further usage.
class ABSUI_API UIConfigurationCenter: public Storage::ConfigurationCenter
{
public:
	///	@brief It initializes the configuration center.
	/// @param connCfgColl the collection of connection configurations that can be used by the application to persist 
	///		projects.
	/// @param profilePath the path (directory name) where the configuration is persisted. It might vary, depending on 
	///		the platform the application runs (Windows, Linux).
	/// @param rUIFactory a reference to the UI factory that can be used for instantiating various UI elements.
	UIConfigurationCenter( 
		Storage::ConnectionConfigCollection& connCfgColl, const std::string& profilePath, UIFactory& rUIFactory);

	/// @brief It gets the factory used for creating various UI elements.
	/// @{
	UIFactory& uiFactory() { return rUIFactory_; }
	const UIFactory& uiFactory() const { return rUIFactory_; }
	/// @}

	/// @brief It gets a casted reference to the singleton instance of this class.
	static UIConfigurationCenter& uiConfigCenter() 
	{ 
		return dynamic_cast< UIConfigurationCenter&>( Storage::ConfigurationCenter::configCenter()); 
	}

private:
	UIFactory& rUIFactory_;
};

} // namespace QtUI

#endif // ABSUI_UI_CONFIGURATION_CENTER_HPP
